package com.qianclass.talklive.app.im;
public class OutPacket {
	public OutPacket()
	{
		bytePayload = new byte[1024*5];
	}
	public byte[] bytePayload = null;
	public int nPayloadLen = 0;
	
	public void push_back(int i)
	{
		System.arraycopy(Converter.int2byte(i), 0, bytePayload, nPayloadLen, 4);
		nPayloadLen+=4;
	}                                                                                                               
	
	public void push_back(short i)
	{
		System.arraycopy(Converter.short2byte(i), 0, bytePayload, nPayloadLen, 2);
		nPayloadLen+=2;
	}
	
	public void push_back(String str)
	{
		byte b[] = str.getBytes();				
		int nLen = b.length;
		short srLen = (short)(nLen+1);
		push_back(srLen);
		
		System.arraycopy(b,0,bytePayload,nPayloadLen,nLen);
		nPayloadLen = nPayloadLen + nLen + 1;
	}
	
	public void push_user_data(String str)
	{
		byte b[] = str.getBytes();	
		int nLen = b.length;
		System.arraycopy(b,0,bytePayload,nPayloadLen,nLen);
		nPayloadLen = nPayloadLen + nLen + 1;
	}
}
